﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="regedit.aspx.cs" Inherits="ProjectX.regedit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>用户注册</title>
    <link href="/WebCss/base.css" rel="stylesheet" type="text/css" />
    <link href="/WebCss/regandlog.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/ClientJs/jquery.js"></script>
    <style type="text/css">
        table
        {
            border-spacing:0;
        }
        .divbody
        {
            background:url("/Webimg/regedit.png") no-repeat;  
        }      
        td
        {
            width:250px;
            height:20px;
            text-align:left;
        }
        input[type="text"],input[type="password"]
        {
            width:220px;
        }
    </style>
    <script language="javascript" type="text/javascript">
        $(document).ready(function () {
            $("input:text:first").focus();
            $(document).keydown(function () {
                if (event.keyCode == 13) {
                    $("#regeditbtn").click();
                }
            });
        });
    </script>
</head>
<body>
<div class="divbody">
    <div id="regheader" class="header">
        <a href="/login.html" target="_self">[登录]</a>
        <a>|</a>
        <a href="/" target="_self">[返回首页]</a>
    </div>
    <form runat="server" id="mainForm" >
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div id="regdiv" class="reglogdiv">
                <table cellpadding="0" cellspacing="0" border="0">
                    <tr>
                        <td>
                            <span id="uname">用户名</span>
                                <asp:RequiredFieldValidator ID="unameValidator" runat="server" 
                                ErrorMessage="请输入用户名" ControlToValidate="username" CssClass="error" 
                                SetFocusOnError="True" Display="Dynamic"></asp:RequiredFieldValidator>
                            <asp:CustomValidator ID="usernameCustomValidator" runat="server" 
                                ErrorMessage="用户名已存在" ControlToValidate="username" CssClass="error" 
                                Display="Dynamic" EnableClientScript="False" 
                                onservervalidate="usernameCustomValidator_ServerValidate" 
                                SetFocusOnError="True"></asp:CustomValidator>
                        </td>
                        <td>
                            <span id="emailspan">邮箱地址</span>
                            <asp:RegularExpressionValidator 
                                ID="emailValidator" runat="server" CssClass="error"
                    ErrorMessage="邮箱地址不正确" ControlToValidate="email" SetFocusOnError="True" 
                                ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Display="Dynamic"></asp:RegularExpressionValidator>
                            <asp:RequiredFieldValidator ID="emailFieldValidator" runat="server" 
                                ErrorMessage="请输入邮箱地址" ControlToValidate="email" CssClass="error" 
                                Display="Dynamic"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:TextBox ID="username" runat="server" cssClass="maintextcss" MaxLength="50"></asp:TextBox>   
                            
                        </td>
                        <td>
                            <asp:TextBox ID="email" runat="server" cssClass="maintextcss" MaxLength="50"></asp:TextBox>
                            
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" style="height:15px;">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <span id="passspan">密&nbsp&nbsp码</span>
                            <asp:RequiredFieldValidator ID="pwdValidator" runat="server" CssClass="error" 
                                ErrorMessage="密码不能为空" ControlToValidate="pwdtxt" SetFocusOnError="True" 
                                Display="Dynamic"></asp:RequiredFieldValidator>
                            <asp:CustomValidator ID="pwdCustomValidator" runat="server" 
                                ErrorMessage="密码小于6位" ControlToValidate="pwdtxt" CssClass="error" 
                                Display="Dynamic" ClientValidationFunction="pwdlength"></asp:CustomValidator>
                        </td>
                        <td>
                            <span id="repassspan">确认密码</span>
                            <asp:RequiredFieldValidator ID="repwdFieldValidator" runat="server" 
                                ErrorMessage="请输入确认密码" ControlToValidate="repwdtxt" CssClass="error" 
                                Display="Dynamic" SetFocusOnError="True"></asp:RequiredFieldValidator>
                            <asp:CompareValidator ID="repwdValidator" runat="server" ErrorMessage="2次密码不一致" 
                                CssClass="error" ControlToValidate="repwdtxt" ControlToCompare="pwdtxt" 
                                SetFocusOnError="True" Display="Dynamic"></asp:CompareValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:TextBox ID="pwdtxt" runat="server" TextMode="Password" cssClass="maintextcss" MaxLength="50"></asp:TextBox>
                        </td>
                        <td>
                            <asp:TextBox ID="repwdtxt" runat="server" TextMode="Password" cssClass="maintextcss" MaxLength="50"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" style="height:20px;">
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <div style="margin:10px auto 0;width:480px;text-align:right;">
                                <asp:CheckBox ID="agree" runat="server" Checked="true" AutoPostBack="True" 
                                    oncheckedchanged="agree_CheckedChanged" /><a>同意服务协议</a>&nbsp&nbsp
                                <asp:ImageButton ID="regeditbtn" runat="server" 
                                    ImageUrl="~/Webimg/regBtn.png" onclick="regeditbtn_Click" 
                                    ImageAlign="AbsMiddle" />
                            </div>
                        </td>
                    </tr>
                </table>
                <script type="text/javascript">
                    function pwdlength(source, arguments) {
                        if (arguments.Value.length < 6) {
                            arguments.IsValid = false;
                        }
                        else {
                            arguments.IsValid = true;
                        }
                    }
                </script>
            </div>
            <div id="regfoot" class="footer">
                <a>隐私条款</a>
                <a>服务协议</a>
                <a>帮助中心</a>
            </div>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="regeditbtn" EventName="Click" />
            <asp:AsyncPostBackTrigger ControlID="agree" EventName="CheckedChanged" />
        </Triggers>
    </asp:UpdatePanel>
    </form>

</div>

</body>
</html>
